import React, { Component } from 'react'
import { commentInter } from '../../data/Interface'

const getcomment = (commendity_id) => {
    let url = `${commentInter}/getlist`
    return (dispatch) => {
        fetch(url, {
            method: 'GET',
            mode: 'cors',
            headers: {
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                commodity_id: `${commendity_id}`
            })
        }).then(res => {
            return res.json()
        }).then(res => {
            dispatch({
                typr: 'GET_COMM',
                value: res.data
            })
        }).catch(err => {
            console.log(err)
        })
    }

}

export { getcomment }
